package org.esprit.ocm.client.ui.one;

import org.esprit.ocm.dto.impl.AwsCredentialsDto;
import org.esprit.ocm.dto.impl.ServerDto;
import org.esprit.ocm.dto.impl.UserDto;

import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;

public class MainAreaOne extends Layout {
	final TabSet topTabSet = new TabSet();

	public MainAreaOne(ServerDto server, AwsCredentialsDto credentials, UserDto user) {

		super();
		this.setOverflow(Overflow.HIDDEN);

		topTabSet.setTabBarPosition(Side.TOP);
		topTabSet.setTabBarAlign(Side.LEFT);
		 
//		addTabToTopTabset("Dashbord", new DashbordZone(server, credentials, user), false);
		addTabToTopTabset("Hosts & Clusters", new HostZone(server, credentials, user), false);
		addTabToTopTabset("Images", new ImageZone(server, credentials, user), false);
		addTabToTopTabset("Virtual Networks", new VnetZone(server, credentials, user), false);
		addTabToTopTabset("Virtual Machines", new VmZone(server, credentials, user), false);

		this.addMember(topTabSet);

	}

	private void addTabToTopTabset(String title, Canvas pane, boolean closable) {
		Tab tab = createTab(title, pane, closable);
		topTabSet.addTab(tab);
	}

	private Tab createTab(String title, Canvas pane, boolean closable) {
		Tab tab = new Tab(title);
		tab.setCanClose(closable);
		tab.setPane(pane);
		return tab;
	}

}